package com.xmy.cultivate.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.xmy.cultivate.entity.StudentGrade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xmy.cultivate.entity.views.ShiftList;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 学生所在班级与课程 服务类
 * </p>
 *
 * @author min
 * @since 2022-08-09
 */
public interface IStudentGradeService extends IService<StudentGrade> {

    public abstract IPage<ShiftList> findAll(IPage<?> page, Wrapper wrapper);

    public abstract boolean divideClasses(Long orderDetailId,Long gradeId);

    public abstract boolean melodyClass(StudentGrade studentGrade);

    public abstract boolean addData(Long orderDetailId,Long schoolId,Long studentId,Long gradeId,Long courseId,Long subjectsId,Integer yearPart,Integer quarterNum, Integer surplusCourseNum);

    public abstract String studentAtGradeState(Long gradeId,Long studentId,Integer reType);

    public abstract String getCourseStatus(Long gradeId,Long studentId,Integer reType);

    public abstract String studentAtGradeStateForOrderDetailId(Long orderDetailId,Long studentId,Integer reType);

    public abstract boolean finishCourse(StudentGrade studentGrade);

    public abstract boolean stopGrade(StudentGrade studentGrade);

    public abstract boolean courseStatusChange(StudentGrade studentGrade);

    public abstract boolean agrainGrade(StudentGrade studentGrade);

    public abstract boolean finishCourseForOrder(StudentGrade studentGrade);

    public abstract boolean stopGradeForOrder(StudentGrade studentGrade);

    public abstract boolean agrainGradeForOrder(StudentGrade studentGrade);

    Long getStudentUseCourseCount(Integer yearPart, Integer quarterNum, Long schoolId, Long subjectsId, Long studentId, Integer lessonType, Integer yearClassId);

    public abstract StudentGrade getLastStudentGradeForOrderDetailId(Long schoolId, Long studentId, Long subjectsId, Integer yearPart, Integer quaterNum, Integer lessonType);

    //void updateIsPresort(Long schoolId, Long studentId, Integer yearPart, Integer quarterNum, Long subjectsId, Integer lessonType);

    void updateStudentIsPresort();

    Long getStudentReadingCount(Integer yearPart, Integer quarterNum, Long schoolId, Long subjectsId, Long studentId, Integer lessonType);

    IPage<StudentGrade> getStudentGradeLastList(IPage<?> page, Integer yearPart, Integer quarterNum, Long schoolId, Long subjectsId);

    StudentGrade getLastOne(Integer yearPart, Integer quarterNum, Long subjectsId, Long studentId, Integer lessonType);

    /**
     * 更新最后一条数据is_last不为1的数据
     * @param yearPart
     * @param quarterNum
     */
    void updateNotIsLast(Integer yearPart, Integer quarterNum);

    void studentClassGradePushMq(Integer yearPart, Integer quarterNum, Long schoolId, Long subjectsId);

    StudentGrade getLastForMaxId(Integer yearPart, Integer quarterNum, Long subjectsId, Long studentId, Integer lessonType, Integer yearClassId);
}
